<h1>Listing users</h1>
<table>
    <tr>
    </tr>
    <% for user in @users %>
    <tr>
        <td>
            <%= link_to 'Show', user %>
        </td>
        <td>
            <%= link_to 'Edit', edit_user_path(user) %>
        </td>
        <td>
            <%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %>
        </td>
    </tr>
    <% end %>
</table>
 
<h2>所有用户</h2>
<div id="users">
    <table>
        <thead>
            <tr>
                <th>用户名</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            <% @users.each do |user| %>
            <tr class="<%= cycle("odd","even") %>">
                <td><%= user.username %></td>                
                <td>
                    <%= link_to image_tag("/images/user.png", :alt => "查看用户信息"),
                    :action => "show", :id => user %>
                    <%= link_to image_tag("/images/user_edit.png", :alt => "修改用户信息"),
                    :action => "edit", :id => user %>
                    <%= link_to image_tag("/images/user_delete.png", :alt => "删除用户"),
                    {:action => "destroy", :id => user},
                    {:confirm => "确定要有删除吗?", :method => :delete} %>
                    <%= link_to image_tag("/images/group_key.png", :alt => "管理用户角色"),
                    :controller => "roles", :action => "index", :user_id => user %>
                </td>
            </tr>
            <% end %>
        </tbody>
    </table>
</div>

<%= link_to 'New user', new_user_path %>
